1. Field of the Invention
The present disclosure relates to variable length coding, and more particularly relates to coefficient variable length coding for video codecs.
2. Description of the Related Art
Portable devices such as mobile phones, digital cameras and camcorders process moving picture data having more pixels than in the past, and require higher computing power at equal power consumption, for example.
Generally a video codec includes processing units such as a motion estimator, a motion compensator, a discrete cosine converter, an inverse discrete cosine converter, a quantizer, an inverse quantizer, a variable length coder and a variable length decoder. Among the processing units, the variable length coder and the variable length decoder have a high dependency on input data, and are not easily implemented with efficient hardware configurations.
As the amount of moving picture data of recent multimedia devices increases, a real time video codec should process more data for a given time. The variable length coder needs to operate bit-by-bit and refer to many reference tables, such that high-speed hardware is required for the variable length coder.
Particularly, a coefficient variable length coder performs a run length coding upon coefficient data to obtain run data, level data and last data (hereinafter, collectively referred to as a “3-dimension value”), and refers to the reference tables to obtain a bit vector corresponding to the 3-dimension value. To compress the coefficient data, the run length coding method inspects data in units of 8×8 data blocks; obtains the run, level and last data; assigns proper variable bit vectors for the run, level, and last data; accumulates the variable bit vectors into a bit stream; and then stores the bit stream into a memory.
The run data represents an accumulative number of previous successive zeros before a non-zero value appears. The level data represents coefficients of the data block when a non-zero value appears. The last data represents the end of the 8×8 block. The above process is done by fetching the coefficient data from the memory, by referring to the reference tables, and by storing or by transferring the bit vectors to the memory or other devices. Thus, the process needs many clock cycles and inevitably requires a pipeline structure.
Depending upon the inputted 3-dimension value, there may be ‘escape data’ that cannot be handled by referring to general reference tables during the coefficient coding process. When the pipeline is broken by such escape data, restoration would consume much time because an address pointer needs to be turned backward in order to recover the 3-dimension value.
Current coefficient data as well as successive coefficient data is generally required in order to obtain the last data in the 3-dimension value, and thus many clock cycles may be wasted in order to recover the previous 3-dimension value because of the broken pipeline. Therefore, it is desirable to minimize the waste of clock cycles for performing the coding process at the occurrence of the escape data, which cannot be treated using the general reference tables, when the pipeline is broken.